package cn.flkj.evidence.repositories;

import cn.flkj.evidence.modles.Evidence;
import cn.flkj.evidence.modles.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

/**
 * @author : 州长在手 2020/9/9 上午11:50
 */
@Mapper
@Service
public interface EvidenceMapper {
    @Insert("INSERT INTO evidence(evidence_md5,user,evidence_name,evidence_address,user_id)" +
            "VALUES(#{evidence_md5},#{user},#{evidence_name},#{evidence_address},#{user_id})")
    int insert(
            @Param("evidence_md5") String evidence_md5,
            @Param("user") String user,
            @Param("evidence_name") String evidence_name,
            @Param("evidence_address") String evidence_address,
            @Param("user_id") int user_id);

    @Select("SELECT * FROM evidence WHERE evidence_md5 = #{evidence_md5}")
    Evidence findByEvidenceMd5(@Param("evidence_md5") String evidence_md5);

    @Select("select count(evidence_id) from evidence;")
    int evidenceIdMax();
//    @Select("SELECT * FROM evidence WHERE evidence_md5 = #{evidence_md5}")
//    Evidence findByEvidenceName(@Param("evidence_md5") String evidence_name);

}
